<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="../inc.jsp"></jsp:include>
		<script src="${ctx}/js/iconfont.js"></script>
		<link rel="stylesheet" href="${ctx}/css/page.css"/>
		<link rel="stylesheet" href="${ctx}/css/iconfont.css"/>
		<meta http-equiv="X-UA-Compatible" content="edge" />
		<title>收款结算页面</title>
		<script type="text/javascript">
		//支付单号, 按照支付单号查询支付单详情
		function payNumber(payNo){
			//console.log(payNo);
			layer.open({
				type: 2,
				title: ['收款单号:'+payNo,'background-color:#00B2EE; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				yes: function(index, layero) {
					layer.close(index);
				},
				btn2: function(index, layero) {
					//取消的回调
				},
				area: ['1200px', '1200px'],  
				content: ['${ctx}/pltmPayment/paymentOrderPage/'+payNo], //iframe的url，no代表不显示滚动条
				success: function(layero, index){
					  layer.full(index);
				},
				end:function(){
					//localtion.reload();
				}
			});
		}
		//审核
		function checkPay(id){
			layer.open({
				type: 2,
				title: ['收款审核','background-color:#00B2EE; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				btn2: function(index, layero) {
					//取消的回调
				},
				area: ['1200px', '500px'],  
				content: ['${ctx}/pltmPayment/checkPay/'+id], //iframe的url，no代表不显示滚动条
				success: function(layero, index){
					  //layer.full(index);
				},
				end:function(){
					 $('#dataGrid').datagrid('load',{url:'${ctx}/pltmPayment/page?temp='+Math.random()});
				}
			});
		}
		//查看
		function viewPay(id){
			//console.log(id);
			layer.open({
				type: 2,
				title: ['收款查看','background-color:#00B2EE; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				yes: function(index, layero) {
					layer.close(index);
				},
				btn2: function(index, layero) {
					//取消的回调
				},
				area: ['1200px', '1200px'],  
				content: ['${ctx}/pltmPayment/paymentDetailPage?id='+id],  //iframe的url，no代表不显示滚动条
				success: function(layero, index){
					  layer.full(index);
				},
				end:function(){
					// localtion.reload();
				}
			});
			
		}
		
		
		$(function(){
			//状态背景文字切换
			$(".listArg").click(function(){
				$(".listArg").css({
					"background": "#f1f1f1",
					"color": "black"
				});
				$(this).css({
					"background": "#34c0e3",
					"color": "#FFFFFF"
				});
				//$(".listArg").removeClass("allStatus"); 
				//alert($(this).find("span").attr('id'))
			});
			
			 $("#query").click(function (){
			        var moneyNumber="";//支付单号
			        var provider="";//采购商
			        var startDate="";//支付开始日期
			        var endDate="";//支付结束日期
			        var status=""; //财务状态
			        moneyNumber=$("#moneyNumber").val();
			        provider=$("#provider").val();
			        startDate=$("#startDate").val();
			        endDate=$("#endDate").val();
			        status=$("#status").combobox("getValue");
			        $("#dataGrid").datagrid('load',{
			            "payNo":moneyNumber,
			            "buyer":provider,
			            "startDate":startDate,
			            "endDate":endDate,
			            "status":status
			        });
			    });
			    dataGrid = $('#dataGrid').datagrid({
			        url: '${ctx}/pltmPayment/page?temp='+Math.random(),
			       // url: '${ctx}/json/data_pay.json',
			        striped : true,
			        singleSelect : true,
			        pagination : true,
			        pageSize : 20,
			        pageList : [ 20, 30, 40, 50, 100, 200, 300, 400, 500 ],
			        idField : ' id',
			        method : 'get',
			      columns:[ [ {
			            width : '100',
			            title : 'id',
			            align : 'center',
			            field : 'id',
			            hidden:true
			        },{
			            width : '150',
			            title : '支付单号',
			            align : 'center',
			            field : 'payNo',
			            formatter:function(value,row,index){
			            	return '<a href="javascript:void(0)" onclick=payNumber("'+row.payNo+'");>'+row.payNo+'</a>';
			             }
			        },/*{
			            width : '100',
			            title : '应收金额',
			            align : 'center',
			            field : 'airlineId',
			        },*/{
			            width : '120',
			            title : '实收金额',
			            align : 'center',
			            field : 'payMoney',
			            formatter:function(value,row){
			            	return "￥"+row.payMoney;
			            }
			        },{
			            width : '150',
			            title : '支付时间',
			            align : 'center',
			            field : 'payTime'
			        },{
			            width : '100',
			            title : '采购商',
			            align : 'center',
			            field : 'organizationName'
			        },{
			            width : '220',
			            title : '支付信息',
			            align : 'center',
			            field : 'act',
			            formatter: function(value,row){
			            	if(row.payType==1){
			            		var payTypeStr="线下支付";
			            	}
			            	if(row.payType==null||row.payType==undefined){
			            		var payTypeStr="线下支付";
			            	}
			            	return "<span>账号："+row.payAccount+"</span>"+"<br/>"+"<span>账户名称："+row.payName+"</span>"+
			            	"<br/>"+"<span>支付方式："+payTypeStr+"</span>";
			            }
			        },{
			            width : '150',
			            title : '支付单状态',
			            align : 'center',
			            field : 'status',
			            formatter: function(value,row){
							switch(row.status+""){
								case "0":
									return "收款待审核";
									break;
								case "1":
									return "已收款";
									break;
								case "-1":
									return "审核不通过";
									break;
							}
						}
			        },{
			            width : '150',
			            title : '操作',
			            align : 'center',
			            field : 'action',
			            formatter:function(value,row,index){
			            	var str='';
			            	if(row.status ==0){
								str += '<a href="javascript:void(0)" class="mynewBtn"  onclick=checkPay("'+row.id+'"); >审核</a>';
							}
			            	if(row.status ==1){
								str += '<a href="javascript:void(0)" class="mynewBtn"  onclick=viewPay("'+row.id+'"); >查看</a>';
							}
			            	return str;
			            }
			        }
			        ] ]
			    });

			
			
		
		}); 
		</script>
	</head>
	<body>
		<jsp:include page="../head.jsp"/>
        <div class="content">
	        <ul class="list">
	            <li>
	            	支付单号：<input type="text" class="textbox" id="moneyNumber"/>
	            </li>
	            <li>
	            	采购商：<input type="text" class="textbox"  id="provider" />
	            </li>
	
	            <li>
	               	 支付日期：
	                <input type="text" id="startDate" class="textbox" onclick="new WdatePicker({dateFmt:'yyyy-MM-dd'})"/> -
	                <input type="text" id="endDate" class="textbox" onclick="new WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
	            </li>
	            <!-- <li>
	                财务状态：
	                <select class="easyui-combobox" data-options="panelHeight:'auto'" id="status">
	                    <option value="">全部</option>
	                    <option value="0">收款待审核</option>
	                    <option value="1">已收款</option>
	                    <option value="-1">审核不通过</option>
	                </select>
	            </li> -->
	            <li class="right">
	            	<input type="button" value="查询" class="query" id="query"/>
	            </li>
	        </ul>
	         <ul class="list conditionList">
					<li>状态：</li>
					<li class="listArg allStatus">
						<span id="" />全部</span>
					</li>
					<li class="listArg">
						<span id="0">待审核<span></span></a>
					</li>
					<li class="listArg">
						<span id="1">已收款<span></span></a>
					</li>
					<li class="listArg">
						<span id="-1">审核未通过<span></span></a>
					</li>
				</ul>
				<table class="conTable" >
				<thead>
					<tr height="38" >
						<td width="219" align="center">采购商</td>
						<td width="173" align="center">支付时间</td>
						<td width="233" align="center">实收金额</td>
						<td width="183" align="center">支付信息</td>
						<td width="100" align="center">支付单状态</td>
					</tr>
				</thead>
				<tbody id="tb">
					<tr height='38' class='reBorder'>
                   		<td width='219' align='center'>支付单号：2425465446</td>
                        <td width='1081' colspan="6" align='right' style='color:#fdc473;cursor:pointer;'><span class="add_minus" style="margin-right:19px;width:62px;height:22px"">支付</span></td>
                    </tr>
					<tr height="90">
						<td width="219" align="center">
							去哪儿
						</td>
						<td width="173" align="center" style="color:black">
							2016-08-08
						</td>
						<td width="233" align="center" style="color:#e47470">
							￥19898
						</td>
						<td width="183" align="center" style="color:black">
							<span style="color:#34c0e3;">账号：1332343</span><br/>
							<span style="color:black;">账户名称：中旅</span><br/>
							<span style="color:black;">支付方式：线下</span>
						</td>
						<td width="100" align="center" style="color:black">已收款</td>
						
					</tr> 
				</tbody> 
			</table>
        </div>
    <!-- <div>
        <table id="dataGrid" class="easyui-datagrid"></table>
    </div> -->
    <jsp:include page="../footer.jsp"/>
	</body>
</html>